﻿module AgiliTrain.Validation.Grammar
{
  type ValidatorType 
  {
    Id : Integer32 => AutoNumber();
    Name : Text(255);
    FullTypeName : Text(1024);
  } where identity Id;
  
  Validators : {ValidatorType*};

  type TypeType
  {
    Id : Integer32 => AutoNumber();
    Name : Text(1024);
    Fields : {FieldType*};
  } where identity Id && value.Fields == Fields.Type(value);
    
  type FieldType
  {
    Id : Integer32 => AutoNumber();
    Name : Text(255);
    FieldValidators : {FieldValidatorType*};
    Type : TypeType where value in Types;
  } where identity Id && value.FieldValidators == FieldValidators.Field(value);
    
  type FieldValidatorType
  {
    Id : Integer32 => AutoNumber();
    Descriptor : Text(255);
    Field : FieldType where value in Fields;
  } where identity Id;
    
  FieldValidators : {FieldValidatorType*};
  Fields : {FieldType*};
  Types : {TypeType*};
    
   
}
